﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace Batman.Jianbei.Forum.Migrations.JianbeiForumDbContext2Migrations
{
    public partial class _201903202 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_InsulinPumpModelId",
                table: "PumpSaleInfomation");

            migrationBuilder.DropColumn(
                name: "ModelId",
                table: "PumpSaleInfomation");

            migrationBuilder.AlterColumn<string>(
                name: "InsulinPumpModelId",
                table: "PumpSaleInfomation",
                maxLength: 36,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_InsulinPumpModelId",
                table: "PumpSaleInfomation",
                column: "InsulinPumpModelId",
                principalTable: "InsulinPumpModel",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_InsulinPumpModelId",
                table: "PumpSaleInfomation");

            migrationBuilder.AlterColumn<string>(
                name: "InsulinPumpModelId",
                table: "PumpSaleInfomation",
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 36);

            migrationBuilder.AddColumn<string>(
                name: "ModelId",
                table: "PumpSaleInfomation",
                maxLength: 36,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_InsulinPumpModelId",
                table: "PumpSaleInfomation",
                column: "InsulinPumpModelId",
                principalTable: "InsulinPumpModel",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
